Re: [GENERAL] Re: [HACKERS] getting at the actual int4 value of an abstime - Mailing list pgsql-general

From Herouth Maoz
Subject Re: [GENERAL] Re: [HACKERS] getting at the actual int4 value of an abstime
Date
Msg-id l03130300b3e06d36a29d@[147.233.159.109]
Whole thread Raw
In response to Re: [HACKERS] getting at the actual int4 value of an abstime  (jim@reptiles.org (Jim Mercer))
List pgsql-general
At 16:33 +0300 on 18/08/1999, Jim Mercer wrote:


> i suspect this would be more efficient than date_part('epoch', timefield).

Yes, but if someday someone decides that dates should be represented in
another way, this will break, and date_part( 'epoch', timefield ) will
always return the seconds since epoch. Data encapsulation thingie.

> also, is there a reverse to this?
>
> ie.  how does one inject unix time_t data into an abstime field.

Into a datetime, simply use datetime( n ). To an abstime, add an abstime()
around the former. Don't try abstime( n ) - at least it doesn't work in 6.4.


> then i bring it in using: "COPY tb USING STDIN;"
>
> it would be nice if i could do a batch of:
> "INSERT INTO tb (time_t, data1, date2) VALUES (934931604, 'aa', 'bb');"

copy is more efficient that a bunch of inserts, mind you.

Herouth

--
Herouth Maoz, Internet developer.
Open University of Israel - Telem project
http://telem.openu.ac.il/~herutma



pgsql-general by date:

Previous
From: jim@reptiles.org (Jim Mercer)
Date:
Subject: Re: [HACKERS] getting at the actual int4 value of an abstime
Next
From: Bruce Tong
Date:
Subject: CVS Import/Export